package com.xzakota.minesweeper.util;

/**
 * 异常处理工具类
 *
 * @author Xzakota
 */
public class ExceptionUtils {
    /**
     * 获取异常的所有堆栈信息
     *
     * @param throwable 异常
     * @return 信息文本
     */
    public static String getExceptionStackTrace(Throwable throwable) {
        StringBuilder builder = new StringBuilder();
        builder.append(throwable.toString()).append("\n");
        for (StackTraceElement element : throwable.getStackTrace()) {
            builder.append("  at ").append(element.toString()).append("\n");
        }
        return builder.toString();
    }
}
